function corrphase()
clear, close all

fig1=double(imread('lena512.bmp'));
fig2=double(imread('eintein.jpg'));


%fig1=fig1/norm(fig1(:)); 
%fig2=fig2/norm(fig2(:));

%F1=radon(fig1,0:359); 
%F2=radon(fig2,0:359); 


PF1=fft2(fig1); 
PF2=fft2(fig2);



pdm = exp(1j*(angle(PF1)-angle(PF2)));

% Solve for phase correlation function
pcf = real(ifft2(pdm));


den=abs(PF1.*PF2); %den=1;

PhaseCorr=(PF2.*conj(PF1))./den; 
PhaseCorr(den==0)=0;


result=ifft2(PhaseCorr);


result=abs(result);
[m M]=max(max(pcf));

figure(3); imshow(log(result),[])
bar3(pcf,'detached')
end

